﻿using System.Collections.Generic;
using System.Linq;
using RestSharp;
using Ymatou.API.Common;
using Ymatou.Evaluate.Buyer.Model.ApiModel.Response.Query;
using Ymatou.ServiceCenter;

namespace Ymatou.Evaluate.Buyer.Model.ApiModel.Request.Query
{
    /// <summary>
    /// 获取订单评价状态
    /// </summary>
    [Resource("bevaluateq.iapi.ymatou.com", "api/GetPendingEvaluateOrders", Method.GET, ParameterBuildType.UrlQueryString)]
    public class GetPendingEvaluateOrdersRequest : BaseRequestModel<GetPendingEvaluateOrdersResponse>
    {
        public override string ApiName { get { return "api/GetPendingEvaluateOrders"; } }
        public override bool HttpGet { get { return false; } }

        /// <summary>
        /// 买家Id
        /// </summary>
        public int BuyerId { get; set; }

        /// <summary>
        /// 上一页最后一条记录的订单Id
        /// </summary>
        public int? LastOrderId { get; set; }

        /// <summary>
        /// 每页显示记录数
        /// </summary>
        public int PageSize { get; set; }


        public override void Validate()
        {
            const string errCode = "-1";
            if (BuyerId <= 0)
            {
                throw new BussniessException(errCode, "非法买家Id");
            }
            //if (LastOrderId.HasValue && LastOrderId.Value < 1)
            //{
            //    throw new BussniessException(errCode, "LastOrderId非法");
            //}
            if (PageSize < 1)
            {
                throw new BussniessException(errCode, "PageSize参数不正确，必须>=1");
            }
            base.Validate();
        }
    }
}
